check if element is visible

93

javascript check if visible -

window.getComputedStyle(document.getElementById("mydivID"),null).getPropertyValue('display')

check if element is visible or hidden in dom -

// Where el is the DOM element you'd like to test for visibility
function isHidden(el) {
    var style = window.getComputedStyle(el);
    return (style.display === 'none')
}

if element is not visible single condtion -

from selenium.common.exceptions import NoSuchElementException

try:
    element=driver.find_element_by_partial_link_text("text")
except NoSuchElementException:
    print("No element found")

Comments

Submit
0 Comments